export default {
    state: {
        id: 0,
        username: ''
    },
    mutations: {
        setUser(state, user) {
            state.id = user.id
            state.username = user.username
            console.log(user.id);
        },
        logout(state) {
            state.id = 0;
            state.username = ''
        }
    },
    actions: {},
    getters: {
        isLogin(state) {
            return state.id != 0
        }
    },
    namespaced: true  //如果有多个模块 不会造成名字的冲突 访问的时候 带了user.xxxx
}